<template>
  <view>
    <defaultCom
      v-if="styleType == 1"
      :couponList="couponList"
      :propsData="propsData"
      @toGetCoupon="toGetCoupon"
    ></defaultCom>
    <card
      v-if="styleType == 2"
      :couponList="couponList"
      :propsData="propsData"
      @toGetCoupon="toGetCoupon"
    ></card>
    <cover
      v-if="styleType == 3"
      :couponList="couponList"
      :propsData="propsData"
      @toGetCoupon="toGetCoupon"
    ></cover>
  </view>
</template>

<script>
import defaultCom from "./default.vue";
import card from "./card.vue";
import cover from "./cover.vue";

export default {
  props: {
    propsData: {
      type: Object,
      default: () => {
        return {};
      },
    },
    couponList: {
      type: Array,
      default: [],
    },
  },
  components: {
    defaultCom,
    card,
    cover,
  },

  computed: {
    styleType() {
      return this.propsData.params.styleType;
    },
  },

  methods: {
    //  点击领取优惠券按钮
    toGetCoupon(e) {
      this.$emit("getCoupon", e);
    },
  },
};
</script>
